/*
    SEL - Simple DirectMedia Layer Extension Library
    Copyright (C) 2001 Matej Knopp <knopp@users.sf.net>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef __sel_videoinfo_h__
#define __sel_videoinfo_h__

#include "sdl.h"

namespace SEL
{

//! Video target information.
/*!
  This object provides read only information about the video
  hardware. If this is called before DisplaySurface::setVideoMode(),
  the vfmt will contain the pixel format of the default video mode.
  
  \warning Before using VideoInfo, the video subsytem must be already
  initialized.
  \sa SEL::init (), DisplaySurface::setVideoMode
 */
class VideoInfo 
{
public:
	//! Update the video information.
	/*!
	  On any error an exception is thrown.
	  \note The video information should be updated automatically so
	  there should be no need for the programmer to call this function
	  manually.
	 */	
	static void getVideoInfo ();
	
	//! Return the wrapped SDL::VideoInfo structure.
	static const SDL::VideoInfo *info () 		{ return m_info; }
	
	//! Return whether the hardware acceleration is available.
	static bool hw_available ();
	
	//! Return whether the window manager is available.
	static bool wm_available ();
	
	//! Return whether the hardware blits are accelerated.
	static bool blit_hw ();
	
	//! Return whether the hardware colorkey blits are accelerated.
	static bool blit_hw_CC ();
	
	//! Return whether the hardware alpha blits are accelerated.
	static bool blit_hw_A ();
	
	//! Return whether the software to hardware blits are accelerated.
	static bool blit_sw ();
	
	//! Return whether the software to hardware colorkey blits 
	//! are accelerated.
	static bool blit_sw_CC ();
	
	//! Return whether the software to hardware alpha blits 
	//! are accelerated.
	static bool blit_sw_A ();
	
	//! Return whether the color fills are accelerated.
	static bool blit_fill ();
	
	//! Return the total amount of video memory in kilobytes.
	static Uint32 video_mem ();
	
	//! Return the pixel format of the video surface.
	static SDL::PixelFormat *vfmt ();

protected:
	//! The wrapped SDL::VideoInfo structure.
	static const SDL::VideoInfo *m_info;
};

//////////////////////////////////////////////////////////////////
//////////////////////// INLINE FUNCTIONS ////////////////////////
//////////////////////////////////////////////////////////////////

inline bool 
VideoInfo::hw_available ()
{
	return m_info->hw_available;
}
	
inline bool 
VideoInfo::wm_available ()
{
	return m_info->wm_available;
}
	
inline bool 
VideoInfo::blit_hw ()
{
	return m_info->blit_hw;
}
	
inline bool 
VideoInfo::blit_hw_CC ()
{
	return m_info->blit_hw_CC;
}
	
inline bool 
VideoInfo::blit_hw_A ()
{
	return m_info->blit_hw_A;
}
	
inline bool 
VideoInfo::blit_sw ()
{
	return m_info->blit_sw;
}
	
inline bool 
VideoInfo::blit_sw_CC ()
{
	return m_info->blit_sw_CC;
}
	
inline bool 
VideoInfo::blit_sw_A ()
{
	return m_info->blit_sw_A;
}	

inline bool
VideoInfo::blit_fill ()
{
	return m_info->blit_fill;
}
	
inline Uint32 
VideoInfo::video_mem ()
{
	return m_info->video_mem;
}
	
inline SDL::PixelFormat *
VideoInfo::vfmt ()
{
	return m_info->vfmt;
}

} // namespace SEL

#endif // __sel_videoinfo_h__
